package com.example.Service.impl;

import com.example.Service.MessageRepository;
import com.example.pojo.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class MessageService {

    @Autowired
    private MessageRepository messageRepository;

    public byte[] getTest(Long id) {
        Message message = messageRepository.findFileById(id);
        return message != null ? message.getFile() : null;
    }

    public void save(Message message) {
        messageRepository.save(message);
    }

    public Message selectFileById(Long id) {
        return messageRepository.findFileById(id);
    }
}